﻿alter table logoinformation
add FromDate datetime null

Go

alter table logodetaildetail
add ThumbnailUrl varchar(250) null
Go
alter table logodetaildetail
add  IsHome bit default(0)

Go
alter table logoinformation
add Url varchar(150) null

Go
-- =============================================  
-- Author:  <Author,,Name>  
-- Create date: <Create Date,,>  
-- Description: <Description,,>  
-- =============================================  
alter PROCEDURE [dbo].[SP_LogInformationInsert]  
@Id int OUTPUT,  
 @CurrentDate Datetime  
           ,@FarmanImage varchar(500)  
           ,@HeaderImage varchar(500)  
           ,@LogoImage varchar(500)  
           ,@CreatedBy varchar(100)  
            
           ,@CreatedDate datetime  
           ,@FromDate datetime,
            @Url varchar(250)
AS  
BEGIN  
 INSERT INTO [dbo].[LogoInformation]  
           ([CurrentDate]  
           ,[FarmanImage]  
           ,[HeaderImage]  
           ,[LogoImage]  
           ,[CreatedBy]  
             
           ,[CreatedDate]  
		   ,FromDate,
             Url
          )  
     VALUES  
           (@CurrentDate  
           ,@FarmanImage  
           ,@HeaderImage  
           ,@LogoImage  
           ,@CreatedBy  ,
             @CreatedDate,
			 @FromDate,
             @Url
           )  
             
            SET @Id = SCOPE_IDENTITY()  
END  
  
  Go


  -- =============================================  
-- Author:  <Author,,Name>  
-- Create date: <Create Date,,>  
-- Description: <Description,,>  
-- =============================================  
alter PROCEDURE [dbo].[SP_LogoDetailDetailInsert]  
 @LogoDetailId int   
           ,@OrderNo int  
           ,@FileName varchar(200) ,
           @Description varchar(500),
		   @Script varchar(max),
           @ThumbnailUrl varchar(250),
           @IsHome bit 
AS  
BEGIN  
 INSERT INTO [dbo].[LogoDetailDetail]  
           ([LogoDetailId]  
           ,[OrderNo]  
           ,[FileName],
           ThumbnailUrl ,
           [Description],
		  Scripts,
           IsHome)  
     VALUES  
           (@LogoDetailId  
           ,@OrderNo  
           ,@FileName,
           @ThumbnailUrl ,
           @Description,
		   @Script,
           @IsHome)  
  
  
END  
  
  Go

  -- =============================================  
-- Author:  <Author,,Name>  
-- Create date: <Create Date,,>  
-- Description: <Description,,>  
-- =============================================  
alter PROCEDURE [dbo].[SP_LogoInformationUpdate]  
 @CurrentDate Datetime  
           ,@FarmanImage varchar(500)  
           ,@HeaderImage varchar(500)  
           ,@LogoImage varchar(500)  
           ,@UpdatedBy varchar(100)  
             
           ,@UpdatedDate datetime  
           ,@Id int  
           ,@FromDate datetime,
            @Url varchar(250)
AS  
BEGIN  
Delete from logodetailDetail  where LogoDetailId in ( select id from logodetail ld where ld.LogoInformationId=@Id)  
Delete from logodetail  where LogoInformationId=@Id  
  
 UPDATE [dbo].[LogoInformation]  
   SET [CurrentDate] = @CurrentDate  
      ,[FarmanImage] = @FarmanImage  
      ,[HeaderImage] = @HeaderImage  
      ,[LogoImage] = @LogoImage  ,
        FromDate = @FromDate,
        Url = @Url
      ,[UpdatedBy] = @UpdatedBy  
        
      ,[UpdatedDate] = @UpdatedDate  
 WHERE Id= @Id  
  
  
  
  
END  
  